-
Notifications
You must be signed in to change notification settings - Fork 768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #87: Don't create duplicate Enums for fields with choices #156
Conversation
@@ -2,7 +2,7 @@ class Registry(object): | |||
|
|||
def __init__(self): | |||
self._registry = {} | |||
self._registry_models = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_registry_models
is not referenced anywhere, so it seemed safe to remove.
It fixes #185 as well. |
Is the fix by @aaxelb going to be merged in soon? Currently can't upgrade to 1.3 :( |
2 similar comments
Store converted Django fields in the registry, so choices enums are not created multiple times when inherited by child models.
1 similar comment
bdc7189
to
f93251b
Compare
This build failure is just on the
And pypy tests pass for me against this branch when I run manually. Worth a core dev retrying the build pipeline, or @aaxelb force-pushing a new commit to this branch to trigger another run? More generally, is there any interest from the core team in taking this fix, or some feedback on what would need to change to be accepted? This issue is blocking me from using graphene in my company, so happy to assist if possible. |
Nice one, all 💚 now. |
very excited to see this fix go live! |
If
convert_django_field_with_choices
is called multiple times on a field with choices, a new Enum will be created each time, which breaks graphene's TypeMap. (#87)I fixed this by storing converted Django fields in the registry, so converting the same field multiple times will return exactly the same converted object.